#include <iostream>

using namespace std;
using ll=long long;
const int MOD=1e5+3;
ll qml(ll x,ll y)
{
	ll ret=1;
	while(y)
	{
		if(y&1)
		{
			ret=ret*x%MOD;

		}
		x=x*x%MOD;
		y>>=1;
	}
	return ret%MOD;
}
int main()
{
	ll m,n;
	cin>>m>>n;
	ll ret=(qml(m,n)-m*qml(m-1,n-1)%MOD+MOD)%MOD;
	cout<<ret<<endl;
	return 0;
}
